function animate(obj, target) {
    console.log(obj);
    clearInterval(obj.timer);
    obj.timer = setInterval(() => {
        if (target == obj.offsetLeft) {
            clearInterval(obj.timer);
        }else {
            var step = (target - obj.offsetLeft) / 10;
            step = target > 0 ? Math.floor(step) : Math.ceil(step);
            obj.style.left = obj.offsetLeft + step + 'px';
            console.log(obj.offsetLeft);
        }
    }, 30);
}